<template>
	<view>
		<button type="primary" open-type="chooseAddress" bindgetuserinfo="getUserInfo" @click="onLogin">登录</button>
	</view>
</template>

<script>
	// import { wxLogin } from "@/api/user";

	export default {
		data() {
			return {

			}
		},
		methods: {
			async onLogin() {
				let _self = this
				uni.showLoading({
					title: "加载中...",
				})
				uni.login({
					success: (res) => {
						if (res.errMsg == "login:ok") {
							console.log(res)
							uni.request({
								url: 'https://www.example.com/request', //仅为示例，并非真实接口地址。
								data: {
									text: 'uni.request'
								},
								header: {
									'custom-header': 'hello' //自定义请求头信息
								},
								success: (res) => {
									console.log(res.data);
									this.text = 'request success';
								}
							})
						}
					},
					complete: () => {
						uni.hideLoading();
					}
				})

			},

		}
	}
</script>

<style>

</style>